package jxau.cn.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import jxau.cn.dao.ListDao;
import jxau.cn.db.DBUtil;
import jxau.xn.servlet.Page;

public class ListDaoImpl implements ListDao {
    Connection conn;
    public ListDaoImpl(){
    	conn=DBUtil.getconn();
    }
	public Page getPage() {
		PreparedStatement psmt1=null;
		ResultSet rs = null;
		Page page=new Page();
		String sql1="select count(*) from t_user";
		try {
			psmt1=conn.prepareStatement(sql1);
			rs=psmt1.executeQuery();
			if(rs.next()){
				page.setCount(rs.getInt(1)/page.getMax());
				page.setPre(1);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return page;
	}

}
